From: Paul Eggert Date: Wed, 20 Apr 2011 08:38:11 +0000 (-0700) Subject: * textprop.c (set_text_properties_1): Rewrite for clarity, X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~4024^2~30 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=f5c709524736fdb964c9640494fbc965fc25b197;p=emacs.git * textprop.c (set_text_properties_1): Rewrite for clarity, and to avoid GCC warning about integer overflow. --- diff --git a/src/ChangeLog b/src/ChangeLog index a9a192735bd..e372a7a7fc2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-04-20 Paul Eggert + * textprop.c (set_text_properties_1): Rewrite for clarity, + and to avoid GCC warning about integer overflow. + * intervals.h (struct interval): Use EMACS_INT for members where EMACS_UINT might cause problems. See . diff --git a/src/textprop.c b/src/textprop.c index d9da36bf36b..64265fd679c 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1348,15 +1348,18 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie register EMACS_INT s, len; INTERVAL unchanged; - s = XINT (start); - len = XINT (end) - s; - if (len == 0) - return; - if (len < 0) + if (XINT (start) < XINT (end)) { - s = s + len; - len = - len; + s = XINT (start); + len = XINT (end) - s; } + else if (XINT (end) < XINT (start)) + { + s = XINT (end); + len = XINT (start) - s; + } + else + return; if (i == 0) i = find_interval (BUF_INTERVALS (XBUFFER (buffer)), s);